﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
using System.Text.RegularExpressions;
using System.Linq;
using System.Net;
using System.Threading;

namespace Wedn.Net.UnitTest
{
    [TestClass]
    public class ThemeCatcher
    {
        [TestMethod]
        public void TestMethod1()
        {
            string css = File.ReadAllText(@"D:\Library\Downloads\style.css");
            var mcs = Regex.Matches(css, @"url\(""(.+?)""\)");
            int count = 0;
            WebClient wc = new WebClient();
            foreach (Match item in mcs)
            {
                var u = item.Groups[1].ToString();
                string url = string.Format("http://www.daqianduan.com{0}", u);
                count++;
                wc.DownloadFile(url, string.Format(@"D:\Library\Downloads\{0}", u).Replace("/wp-content/themes/d8/",string.Empty));
                Thread.Sleep(500);
            }
            var c = count;
        }
    }
}
